package com.bdzl.daoRepository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.bdzl.pojo.Admin;

public interface  AdminDao extends JpaRepository<Admin, Integer>  {

	Admin findByAccountAndPassword(String name, String password);

	@Modifying
	@Query(" update Admin set type = 0 where id = :id ")
	void updatetype(@Param("id")Integer adminId);

	Admin findById(Integer adminId);

	
	@Modifying
	@Query(" update Admin set name = :name ,account = :account , password = :password , authrity = :authrity  where id = :id ")
	void updateall(@Param("id")Integer adminId,@Param("account") String account,@Param("authrity") Integer authrity,@Param("password") String password, @Param("name")String name);

	
	@Modifying
	@Query(" update Admin set name = :name ,account = :account ,  authrity = :authrity  where id = :id ")
	void updateaps(@Param("id")Integer adminId,@Param("account") String account,@Param("authrity") Integer authrity,@Param("name")String name);

	
	
	List<Admin> findByType(Integer i);

	
}
